/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.travelFinder.domain;

import java.util.Set;
import org.neo4j.graphdb.Direction;
import org.springframework.data.neo4j.annotation.GraphId;
import org.springframework.data.neo4j.annotation.Indexed;
import org.springframework.data.neo4j.annotation.NodeEntity;
import org.springframework.data.neo4j.annotation.RelatedToVia;

/**
 *
 * @author Kryl
 */
@NodeEntity
public class Place {

    @GraphId
    Long id;
    
    @Indexed  
    String name;
    
    @RelatedToVia(type="CONNECTION_TO",elementClass=Connection.class,direction=Direction.OUTGOING)
    Set<Connection> connections;

    protected Place() {       
    }
    
    
    
    public Place(String name) {
        this.name = name;
    }

    public Long getId() {
        return id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
     
    
    public boolean addConnection(Connection e) {        
        return connections.add(e);
    }

    public boolean removeConnection(Connection o) {
        return connections.remove(o);
    }
    
}
